using System.Collections.Generic;
using Mono.Cecil;
using OpenReflect.Common.Helpers;
using OpenReflect.Domain.Contracts.Declarations;
using OpenReflect.Domain.Model.Declarations;

namespace OpenReflect.Services.Builders
{
	public interface IMethodDeclarationBuilder : IDeclarationBuilder
	{
		IList<IMethodDeclaration> CreateMethodDeclarations(TypeDefinition definition);
		IMethodDeclaration CreateMethodDeclaration(MethodDefinition definition);
	}

	public class MethodDeclarationBuilder : IMethodDeclarationBuilder
	{
		#region IMethodDeclarationBuilder Members

		public IList<IMethodDeclaration> CreateMethodDeclarations(TypeDefinition definition)
		{
			return null;
		}

		public IMethodDeclaration CreateMethodDeclaration(MethodDefinition cecilDefinition)
		{
			IMethodDeclaration declaration = new MethodDeclaration();
			declaration.Name = cecilDefinition.Name;
			declaration.IsAbstract = cecilDefinition.IsAbstract;
			declaration.AccessModifier = AccessorHelper.GetMethodAccessor(cecilDefinition);
			declaration.IsStatic = cecilDefinition.IsStatic;
			declaration.IsVirtual = cecilDefinition.IsVirtual;

			//cecilDefinition.
			return declaration;
		}

		#endregion
	}
}